/*
 * 文件名：LocalRotaServiceImpl.java	 
 * 时     间：下午3:36:32
 * 作     者：Administrator       
 * 版     权： 2012-2022 湖南智软网络科技, 公司保留所有权利.
 * 联     系：http://www.073586.com/
 */
package com.local.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.local.dao.mapers.LocalWeekSectionMapper;
import com.local.model.LocalChargeBytime;
import com.local.model.LocalWeekSection;
import com.local.model.LocalWeekSectionExample;
import com.local.service.face.LocalWeekSectionService;
import com.qianhai.common.dao.face.BaseMapper;
import com.qianhai.common.exception.BaseException;
import com.qianhai.common.service.impl.BaseServiceImpl;
import com.qianhai.common.utils.Tools;
import com.qianhai.common.utils.UUIDGenerateUtil;

@Service
public class LocalWeekSectionServiceImpl extends
BaseServiceImpl<LocalWeekSectionExample, LocalWeekSection, String> implements LocalWeekSectionService
{
	@Autowired
	private LocalWeekSectionMapper localWeekSectionMapper;
	


	@Override
	public String saveLocalWeekSection(LocalChargeBytime localChargeBytime)
	{
		// TODO Auto-generated method stub
		LocalWeekSection localWeekSection=new LocalWeekSection();
		try
		{
				localWeekSection.setUuid(UUIDGenerateUtil.generate());
				localWeekSection.setChargeBytimeUuid(localChargeBytime.getChargeBytimeUuid());
				localWeekSection.setSectionEndTime(localChargeBytime.getSectionEndTime());
				localWeekSection.setSectionStartTime(localChargeBytime.getSectionStartTime());
				localWeekSection.setCarTypeUuid(localChargeBytime.getCarType());
				localWeekSection.setSection(!Tools.isEmpty(localChargeBytime.getSection())?localChargeBytime.getSection():"2");
				localWeekSection.setType(!Tools.isEmpty(localChargeBytime.getType())?localChargeBytime.getType():"3");
				localWeekSectionMapper.insert(localWeekSection);
		} catch (Throwable e)
		{
			throw new BaseException(e.getMessage());
		}
		return localWeekSection.getUuid();
	}

	@Override
	public BaseMapper<LocalWeekSectionExample, LocalWeekSection, String> getMapper()
	{
		// TODO Auto-generated method stub
		return localWeekSectionMapper;
	}

	@Override
	public List<LocalWeekSection> loadAllWeekSection(String carTypeUuid)
	{
		// TODO Auto-generated method stub
		return localWeekSectionMapper.loadAllWeekSection(carTypeUuid);
	}

	@Override
	public LocalWeekSection loadAllWeekSectionByChargUuid(
			String chargeBytimeUuid)
	{
		// TODO Auto-generated method stub
		return localWeekSectionMapper.loadAllWeekSectionByChargUuid(chargeBytimeUuid);
	}

	@Override
	public void deleteWeekSection(String chargeBytimeUuid)
	{
		// TODO Auto-generated method stub
		localWeekSectionMapper.deleteWeekSection(chargeBytimeUuid);
	}
}
